package net.worldscale.xp.wspr;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;

public abstract class Console {

    public abstract void setInput(InputStream is);

    public abstract void setOutput(OutputStream os);

    public abstract PrintStream getOutput();

    public abstract void close();

    public abstract void registerCommand(Command cmd);

    public abstract boolean executeCommand(String cmdLine);

    public abstract Command[] getCommands();

    public abstract void setTitle(String title);

    public abstract String getTitle();

    public static abstract class Parameter {

        public abstract String getName();

        public abstract String getValue();
    }

    public static abstract class ExecuteContext {

        public abstract Console getConsole();

        public abstract String getCommandName();

        public abstract Parameter[] getParameters();

        public abstract String getParameterValueByName(String parameterName);
    }

    public static abstract class Command {

        public abstract String getName();

        public abstract void execute(ExecuteContext ec);

        public abstract String getHelpText();
    }
}
